import { reqCategoryList } from "@/api";

const state = {
  categoryList: [],
};
const mutations = {
  SET_CATEGORYLIST_STATE(state, payload) {
    state.categoryList = payload.categoryList;
  },
};
const actions = {
  async getCategoryList({ commit }) {
    //发送请求
    const result = await reqCategoryList();

    commit("SET_CATEGORYLIST_STATE", { categoryList: result });
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
